﻿@model PH.Model.Schools.StudentModel
<style>
    .divToolbar .t {line-height:25px; font-size:18px; padding:5px; }
</style>
<div class="k-block divToolbar">
    <span class="t">@Model.ClassName</span>
    <span class="t">@Model.RealName</span>
    <span class="t">@(Model.Sex==1?"男":"女")</span>
</div>
<div id="grid_dbs" style="text-align: center"></div>

<script class="init">
    
</script>

<script class="grid">
    $(function () {
        var fields = [{
            title: "项目",
            field: "Subject.SubjectName",
            sortable: false,
            width: 150
        }, {
            title: "成绩",
            field: "Achievement",
            template: "#=ShowAchievement(Achievement,Subject.Category)#",
            sortable: false,
            width: 80
        }, {
            title: "得分",
            field: "Score",
            sortable: true,
            width: 60
        }, {
            title: "评价",
            field: "Description",
            sortable: false,
            width: 70
        }, {
            title: "加分",
            field: "AdditionalScore",
            sortable: false,
            width: 60
        }, {
            title: "操作",
            template: "#=GetOperations(ID)#",
            attributes: { style: "text-align:left" }
        }];

        $("#grid_dbs").kendoGrid({
            columns: fields,
            dataSource: Whale.dataSource({
                url: "/Achivevments/Mark/Gets",
                getParameters: function () {
                    return {
                        aGuid: $("#selArchive").data("kendoDropDownList").value(),
                        stuGuid:"@Model.Guid",
                        getSubject: true,
                    };
                }
            }),
            pageable:false,
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            },
            sortable: true
        });
    });

    function ShowAchievement(achievement, category) {
        if (category == 3) {
            return ShowTime(achievement);
        }
        else
            return achievement;
    }

    function GetOperations(id) {
        var html = "<button class='k-button' onclick=\"Edit(" + id + ")\"><span class='k-icon k-i-pencil'></span><span>修改</span></button>";
        return html;
    }

    function Edit(id) {
        if (wndGeneralEdit != null && typeof wndGeneralEdit != "undefined") {
            wndGeneralEdit.setOptions({ title: "修改学生成绩" });
            wndGeneralEdit.refresh({ url: "/Achievements/Mark/Edit/" + id });
            wndGeneralEdit.open();
        }
    }
</script>
